/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gm.entities;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Med EL MOUDDENE
 */
@Entity
@Table(name = "subir_examen_remarque")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SubirExamenRemarque.findAll", query = "SELECT s FROM SubirExamenRemarque s"),
    @NamedQuery(name = "SubirExamenRemarque.findByIdPersonne", query = "SELECT s FROM SubirExamenRemarque s WHERE s.subirExamenRemarquePK.idPersonne = :idPersonne"),
    @NamedQuery(name = "SubirExamenRemarque.findByIdExamen", query = "SELECT s FROM SubirExamenRemarque s WHERE s.subirExamenRemarquePK.idExamen = :idExamen"),
    @NamedQuery(name = "SubirExamenRemarque.findByIdRemarque", query = "SELECT s FROM SubirExamenRemarque s WHERE s.subirExamenRemarquePK.idRemarque = :idRemarque")})
public class SubirExamenRemarque implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SubirExamenRemarquePK subirExamenRemarquePK;
    @JoinColumn(name = "ID_EXAMEN", referencedColumnName = "ID_EXAMEN", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Examen examen;
    @JoinColumn(name = "ID_PERSONNE", referencedColumnName = "ID_PERSONNE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Personne personne;
    @JoinColumn(name = "ID_REMARQUE", referencedColumnName = "ID_REMARQUE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Remarque remarque;

    public SubirExamenRemarque() {
    }

    public SubirExamenRemarque(SubirExamenRemarquePK subirExamenRemarquePK) {
        this.subirExamenRemarquePK = subirExamenRemarquePK;
    }

    public SubirExamenRemarque(int idPersonne, int idExamen, int idRemarque) {
        this.subirExamenRemarquePK = new SubirExamenRemarquePK(idPersonne, idExamen, idRemarque);
    }

    public SubirExamenRemarquePK getSubirExamenRemarquePK() {
        return subirExamenRemarquePK;
    }

    public void setSubirExamenRemarquePK(SubirExamenRemarquePK subirExamenRemarquePK) {
        this.subirExamenRemarquePK = subirExamenRemarquePK;
    }

    public Examen getExamen() {
        return examen;
    }

    public void setExamen(Examen examen) {
        this.examen = examen;
    }

    public Personne getPersonne() {
        return personne;
    }

    public void setPersonne(Personne personne) {
        this.personne = personne;
    }

    public Remarque getRemarque() {
        return remarque;
    }

    public void setRemarque(Remarque remarque) {
        this.remarque = remarque;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (subirExamenRemarquePK != null ? subirExamenRemarquePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SubirExamenRemarque)) {
            return false;
        }
        SubirExamenRemarque other = (SubirExamenRemarque) object;
        if ((this.subirExamenRemarquePK == null && other.subirExamenRemarquePK != null) || (this.subirExamenRemarquePK != null && !this.subirExamenRemarquePK.equals(other.subirExamenRemarquePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.gm.entities.SubirExamenRemarque[ subirExamenRemarquePK=" + subirExamenRemarquePK + " ]";
    }
    
}
